StateEvent

open class StateEvent @JvmOverloads constructor(val state: String, data: Any? = null, postEvent: () -> Unit? = null) : Event

An event representing a change in the chat session's lifecycle state.

StateEvent is delivered through ChatEventListener.onChatStateChanged each time the chat transitions between states. Use the state property to determine the current lifecycle phase, and data for any associated payload.

For Ended and Closed, data contains the EndedReason indicating why the chat ended. Most integrators react to Closed (the terminal state), but Ended also carries EndedReason in cases such as a force-close, an idle timeout, or a recoverable disconnect.

The typical happy-path progression is:

Preparing → Prepared → Started → Ending → Ended → Closed

Parameters

state

The current state of the chat session. One of the constants defined in the companion object.

Inheritors

Constructors

Link copied to clipboard
constructor(state: String, data: Any? = null, postEvent: () -> Unit? = null)

Types

Link copied to clipboard
object Companion

The chat lifecycle states used as values of state.

Properties

Link copied to clipboard
var data: Any?

Optional payload attached to the event.

Link copied to clipboard
val postEvent: () -> Unit?

Unused. The SDK never invokes this callback.

Link copied to clipboard
Link copied to clipboard

The event category, for example "state" for com.genesys.cloud.integration.core.StateEvent or "error" for com.genesys.cloud.integration.core.ErrorEvent.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Two events are equal when their type, data, and postEvent are equal.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code based on type.